#!/bin/sh

set -e # Exit immediately if a command exits with a non-zero status.
set -u # Treat unset variables as an error.

if [ "${WEB_LISTENING_PORT:-5800}" -eq -1 ]; then
    echo "Not listening for web connections."
else
    if is-bool-val-false "${SECURE_CONNECTION:-0}"; then
        conn_type="HTTP"
    else
        conn_type="HTTPs"
    fi
    echo "Listening for ${conn_type} connections on port ${WEB_LISTENING_PORT:-5800}."
fi

exec /opt/base/sbin/nginx "$@"

# vim:ft=sh:ts=4:sw=4:et:sts=4
